package leetcode.code206.ReverseLinkedList;

import leetcode.helper.HelpDebug;
import leetcode.helper.tree.ListNode;

public abstract class ReverseLinkedList implements IReverseLinkedList {

	@Override
	public void debug1() {
//		输入：head = [1,2,3,4,5]
//		输出：[5,4,3,2,1]
		int[] input = new int[] { 1, 2, 3, 4, 5 };
		int[] output = new int[] { 5, 4, 3, 2, 1 };
		ListNode head = new ListNode().setArray(input);
		HelpDebug.printInputs(output, new Object[] { head });
		ListNode result = this.reverseList(head);
		HelpDebug.printObject(result);
	}

	@Override
	public void debug2() {
//		输入：head = [1,2]
//		输出：[2,1]
		int[] input = new int[] { 1, 2, };
		int[] output = new int[] { 2, 1 };
		ListNode head = new ListNode().setArray(input);
		HelpDebug.printInputs(output, new Object[] { head });
		ListNode result = this.reverseList(head);
		HelpDebug.printObject(result);
	}

	@Override
	public void debug3() {
//		输入：head = []
//		输出：[]
		int[] input = new int[] {};
		int[] output = new int[] {};
		ListNode head = new ListNode().setArray(input);
		HelpDebug.printInputs(output, new Object[] { head });
		ListNode result = this.reverseList(head);
		HelpDebug.printObject(result);
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	abstract public ListNode reverseList(ListNode head);

}
